#include "MultiAgent.h"

#include "470bot.h"
#include "World.h"
#include "Graph.h"
#include "Command.h"
#include "AgentState.h"
#include "FollowSearchPathState.h"

MultiAgent::MultiAgent(tank_t* tank)
{	
	this->currentState = NULL;
	this->tank = tank;
}

MultiAgent::~MultiAgent(void)
{
}

void MultiAgent::setState(AgentState* newState) {
	if (currentState) {
		currentState->exit(this);
		delete currentState;
	}

	currentState = newState;

	if (currentState)
		currentState->enter(this);
}

Command MultiAgent::GetCommand() {
	if (currentState)
		return currentState->GetCommand(this);

	return Command(this->tank->index, 0, 0, false);
}

tank_t* MultiAgent::getTank() {
	return this->tank;
}
